package org.tabcap.main;

import java.applet.Applet;
import java.awt.BorderLayout;
import java.awt.Container;
import java.awt.Frame;

import org.pushingpixels.substance.api.skin.OfficeBlack2007Skin;
import org.tabcap.TCInstance;

import com.meg.swing_utils.SwingInvoker;
import com.meg.swing_utils.laf.LookAndFeel;

public class TabCapApplet extends Applet
{
	private static final long serialVersionUID = -7094741756602823402L;

	public final void init()
	{
		new TabCapAppletInvoker().start();
	}
	
	private Frame getFrame()
	{
		Container c = this;
		while (c != null)
		{
			if (c instanceof Frame)
				return (Frame) c;
			c = c.getParent();
		}
		return (Frame) null; 
	}
	
	protected class TabCapAppletInvoker extends SwingInvoker
	{
		public void run()
		{
			LookAndFeel.Substance.init(new OfficeBlack2007Skin());
			
			setLayout(new BorderLayout());
			add(new TCInstance(getFrame()), BorderLayout.CENTER);
		}
	}
}